<html >
    <head>
        <meta charset="utf-8"/>
        <link rel="stylesheet" href="main.css" />
        <script>
        	var GLOBALVAL_mode = "phoneGap";
        </script>
        <script src="cordova.js?ver=1"></script>
        <script src="sysFunc.js?ver=21"></script>
        <script src="ZipPlugin.js"></script>
        <script src="env.js"></script>
        <script src="global.js?ver=21"></script>
        <script src="index.js?ver=21"></script>
        <script src="jsMap.js"></script>
        <script src="fileOperator.js?v=2"></script>
        <script src="jquery-2.0.0.js"></script>
        <script>
        	var language = GLOBALFUN_getLanguage();
        	$.ajaxSetup({async: false});
        	if(language=="chinese"){
        		$.getScript("message.js?ver=182");
        	}else{
        		$.getScript("message_en.js?ver=182");
        	}
        	$.ajaxSetup({async: true});
        </script>
  		<script>
  			function init(){
  				console.log("init in");
  				tipShow();
   				var href = "http://192.168.1.1:9080/okApp/okAppClient/assets/youbabelMobile/app_index.html?ver=" + Math.random();
  				//href = "http://www.okkouyu.com:9080/okAppMobile/okAppClient/assets/youbabelMobile/app_index.html?ver=" + Math.random();
  				href = "index.html?ver=" + Math.random();
  				var pageType = getUrlParamString("pageType");
  				var firstRun = getUrlParamString("first");
  				console.log("firstRun flag:" + firstRun);
  				if(pageType&&pageType.length>0){
  					href = href + "&pageType=" + pageType;
  					if(pageType==1){
  						href = href + "&targetId=" + getUrlParamString("targetId");
  					}
  					console.log("href is:" + href);
  				}
  				document.addEventListener("deviceready", function() {
  					initProcess(href,firstRun);
  					//window.location.href = href;
  				});

  			}
  			function tipShow(){
  				$("#initTip").html(TIPMSG_deviceInit);
  				$("#header").html("呼叫云");
  		 	}
			function getUrlParamString(name) {
				if(!location||!location.href){
					return null;
				}
				// 如果链接没有参数，或者链接中不存在我们要获取的参数，直接返回空
				if (location.href.indexOf("?") == -1 || location.href.indexOf(name + '=') == -1) {
					return null;
				}
				// 获取链接中参数部分
				var queryString = location.href.substring(location.href.indexOf("?") + 1);
				// 分离参数对 ?key=value&key2=value2
				var parameters = queryString.split("&");
				var pos, paraName, paraValue;
				for (var i = 0; i < parameters.length; i++) {
					// 获取等号位置
					pos = parameters[i].indexOf('=');
					if (pos == -1) {
						continue;
					}
					// 获取name 和 value
					paraName = parameters[i].substring(0, pos);
					paraValue = parameters[i].substring(pos + 1);

					// 如果查询的name等于当前name，就返回当前值，同时，将链接中的+号还原成空格
					if (paraName == name) {
						return unescape(paraValue.replace(/\+/g, " "));
					}
				}
				return '';
			};
  		</script>
    </head>
    <body onload="init();">
    	<div id="header" class="header"></div>
    	<div class="loadArea">
            <div class="imgLogo"><img src="log.png" alt=""></div>
	    	<div class="imageArea"><img src="loading.gif"/></div>
			<div class="loadTip" id="initTip"></div>
		</div>
    </body>
</html>
